package com.lanou.service;/*
 * @author 马继耿~
 * @date 2023/10/26 14:20
 * @version 1.0
 * */

import com.lanou.mapper.MJG_AddlishiMapper;
import com.lanou.pojo.PaymentPreEntity;
import com.lanou.pojo.PaymentTemp;
import com.lanou.pojo.PaymentTempEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Service
public class MJG_AddlinshiServiceImlp implements MJG_AddlishiService{
    @Autowired
    private MJG_AddlishiMapper mjg_addlishiMapper;
    @Override
    public String add(PaymentTempEntity paymentTempEntity) throws ParseException {
        // 获取当前时间戳
        long timestamp = System.currentTimeMillis();
        paymentTempEntity.setId(String.valueOf(timestamp));
        paymentTempEntity.setResourceId(String.valueOf(timestamp));
        paymentTempEntity.setBlock("01");
        paymentTempEntity.setFeeItemId("1471683203705188353");
        paymentTempEntity.setRefundType(" ");
        paymentTempEntity.setOperateUser("1");
        paymentTempEntity.setPayNo("PAY2022062800201");
        paymentTempEntity.setRefundNo(" ");
        paymentTempEntity.setState("paied");
//        // 将时间戳转换为Date对象
//        Date date = new Date(timestamp);
        mjg_addlishiMapper.add(paymentTempEntity);
        return paymentTempEntity.getId();
    }

    @Override
    public void delect(String id) {
        mjg_addlishiMapper.delete(id);
    }
}
